package com.rfsp.mcp.mapper;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.rfsp.common.base.BaseMapper;
import com.rfsp.mcp.pojo.po.OrgYbjPO;
import com.rfsp.mcp.pojo.sdto.OrgYbjSDTO;
import com.rfsp.mcp.pojo.vo.OrgYbjVO;
import org.springframework.stereotype.Repository;

@Repository
public interface OrgYbjMapper extends BaseMapper<OrgYbjPO> {
    /**
     * 获取医保局定点机构信息列表
     * @param sdto
     * @return
     */
    List<OrgYbjVO> getOrgYbjList(OrgYbjSDTO sdto);


    List<OrgYbjVO> get(OrgYbjSDTO sdto);
    
    
    @Select(" SELECT ybj.id, ybj.aid, ybj.org_id, ybj.source, ybj.upload_time, ybj.upload_user_id, " +
            " ybj.org_no, ybj.org_name, ybj.org_code, ybj.org_type, ybj.org_class, ybj.corporation, " +
            " ybj.com_name, ybj.director, ybj.address, ybj.biz_nature, ybj.biz_subject, ybj.account_name, " +
            " ybj.account_no, ybj.account_bank, ybj.opt_user_id, ybj.opt_time, ybj.opt_type, ybj.remark1, ybj.remark2, ybj.remark3, ybj.remark4, ybj.remark5, " +
            " ybj.source_code, ybj.pfm_id, ybj.valid_flag, ybj.approve_time, ybj.approve_no, ybj.valid_start_date, ybj.valid_end_date, " +
            " ybj.bed_num, ybj.pro_license_no, ybj.prolicno_timelimit, ybj.org_grade, ybj.fee_level, ybj.affiliation, ybj.economic_type, ybj.mi_grade, ybj.pay_type, " +
            " ybj.remark6, ybj.remark7, ybj.remark8, ybj.remark9, ybj.remark10, ybj.create_time, ybj.update_time, nvl(a.area_full_name, ybj.BIZ_AREA) biz_area " +
            " FROM MCP_ORG_YBJ ybj  " +
            " left join mcp_area a on ybj.biz_area = a.area_code " +
            " WHERE ybj.id = #{id} and ybj.aid = #{aid} ")
    OrgYbjPO getYbjBy2Id(@Param("id") Long id, @Param("aid") String aid);



    public int queryOrgDirectory(OrgYbjPO orgYbjPO);

    public int insertOrgDirectory(OrgYbjPO orgYbjPO);

    /** 同步医保定点机构名录接口，用来存储名录信息*/
    public int updateOrgDirectory(OrgYbjPO orgYbjPO);


    /** 同步医保定点机构主体信息接口，用来存储主体信息*/
    public int queryOrgSubjectInfo(OrgYbjPO orgYbjPO);

    public int insertOrgSubjectInfo(OrgYbjPO orgYbjPO);

    /** 同步医保定点机构名录接口，用来存储名录信息*/
    public int updateOrgSubjectInfo(OrgYbjPO orgYbjPO);


//    @Select("SELECT * FROM MCP_ORG_YBJ WHERE ORG_ID = #{targetOrgId} and PFM_ID = #{pfmId}")
//    OrgYbjPO findByOrgIdAndPfmId(@Param("targetOrgId") Long targetOrgId,@Param("pfmId") Long pfmId);
}